﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LinFu.IoC.Configuration;
using LinFu.IoC.Interfaces;
using LinFu.Reflection;

namespace CoreEx.Services
{
    public class ContainerLoader : Loader
    {
        protected override bool ShouldLoad(ILoaderPlugin<IServiceContainer> plugin)
        {            
            //Do not load member injector plugins            
            
            var pluginType = plugin.GetType();
            var pluginBaseType = pluginType.BaseType;
            if (pluginBaseType.IsGenericType && pluginBaseType.GetGenericTypeDefinition() == typeof(AutoMemberInjector<>))
                return false;
            
            return base.ShouldLoad(plugin);
        }
    }
}